package cn.zsb.proxy.jdkProxy;

public class Client {
    public static void main(String[] args) {
        //目标对象(被代理对象)
        TeacherDaoImpl target = new TeacherDaoImpl();
        //代理工厂
        ProxyFactory proxyFactory = new ProxyFactory();
        //设置代理对象
        proxyFactory.setTarget(target);
        //代理对象
        TeacherDao proxy = (TeacherDao) proxyFactory.getProxyInstance();

        System.out.println(proxy.getClass());
        System.out.println("----------------");
        proxy.teach();
        System.out.println("----------------");
        String math = proxy.test("数学");
        System.out.println("----------------");
        System.out.println("test方法返回值："+math);
    }
}
